package com.bangbang.service.impl;

import com.bangbang.mapper.TbGroupCourseOrderMapper;
import com.bangbang.pojo.TbGroupCourseOrder;
import com.bangbang.service.ITbGroupCourseOrderService;
import com.bangbang.service.ITbGroupCourseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 拼团课程商品订单表 服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2021-08-13
 */
@Service
public class TbGroupCourseOrderServiceImpl extends ServiceImpl<TbGroupCourseOrderMapper, TbGroupCourseOrder> implements ITbGroupCourseOrderService {

    @Autowired
    private TbGroupCourseOrderMapper orderMapper;

    @Autowired
    private ITbGroupCourseOrderService tbGroupCourseOrderService;

    @Autowired
    private ITbGroupCourseService groupCourseService;

    @Override
    public void queryOrderById(String out_trade_no, String trade_no) {
        /*try {
            // Wrapper  wrapper = new W
            War
            TbGroupCourseOrder courseOrder = tbGroupCourseOrderService.getById(out_trade_no);
            courseOrder.setGcoTransactionId(trade_no).setGcoStatus("1");
            TbGroupCourse tbGroupCourse = groupCourseService.selectGroPerson(Long.parseLong(out_trade_no));
            tbGroupCourse.setGroPerson(tbGroupCourse.getGroPerson() - 1);
            groupCourseService.updateById(tbGroupCourse);
        }catch (NullPointerException e){
            System.err.println("无此数据");
        }*/
    }

    @Override
    public void createOrder(TbGroupCourseOrder courseOrder) {
        orderMapper.insertResultId(courseOrder);
    }
}
